<template>
  <div class="CommonModal">
    <van-overlay :show="isShow">
      <view class="wrapper">
        <div class="block">
          <div class="title">{{ data.title }}</div>
          <pre class="content" v-html="data.content"></pre>
          <div class="btn" @click="handelOk">我知道了</div>
          <div class="icon" @click="handelOk">
            <i class="iconfont iconguanbi" style="color: #C4C4C4;"></i>
          </div>
        </div>
      </view>
    </van-overlay>
  </div>
</template>

<script>
export default {
  data () {
    return {
      isShow: false,
      data: {
        title: '',
        content: '',
        ok () { },
      },
    }
  },
  methods: {
    $show (data) {
      this.data = data
      this.isShow = true
    },
    handelOk () {
      this.isShow = false
      this.data.ok && this.data.ok()
    },
  },
}
</script>

<style lang="scss" scoped>
@import "~css/var.scss";
.CommonModal {
  .wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    .block {
      position: relative;
      box-sizing: border-box;
      max-width: 95vw;
      padding: 20px 34px;
      background: rgba(255, 255, 255, 1);
      border-radius: 5px;
      text-align: center;
      .icon {
        position: absolute;
        top: 16px;
        right: 16px;
      }
      .title {
        line-height: 24px;
        font-size: $fz-xl;
        font-weight: bold;
        color: rgba(20, 20, 20, 1);
      }
      .content {
        margin-top: 10px;
        font-size: $fz-l;
        font-weight: 500;
        line-height: 30px;
        color: rgba(102, 102, 102, 1);
      }
      .btn {
        width: 137px;
        height: 39px;
        margin: 0 auto;
        margin-top: 20px;
        line-height: 39px;
        border-radius: 20px;
        font-size: $fz-xl;
        font-weight: bold;
        color: rgba(255, 255, 255, 1);
        background: #d1272f;
      }
    }
  }
}
</style>
